export const debounce = (fn: (...args: any) => any, time: number) => {
    let timer: NodeJS.Timeout | null = null;
    return (...args: any) => {
      if(timer) {
        clearTimeout(timer);
      }
      timer = setTimeout(() => {
        fn(...args)
     }, time)
    }
}